/*
*******************************************************************************************************
*
* File Name : uart.h
* Version   : V1.0
* Author    : mzy2364
* brief     : uart header file
* 
*******************************************************************************************************
*/
#ifndef _UART_H_
#define _UART_H_

#ifdef __cplusplus
extern "C"{
#endif

/* INCLUDE FILES ------------------------------------------------------------------------------------*/
#include "gd32f30x.h"


/* DEFINES ------------------------------------------------------------------------------------------*/
#define ARRAYNUM(arr_name)      (uint32_t)(sizeof(arr_name) / sizeof(*(arr_name)))
#define UART2_DATA_ADDRESS      ((uint32_t)&USART_DATA(USART2))


/* VARIABLES ----------------------------------------------------------------------------------------*/


/* FUNCTION -----------------------------------------------------------------------------------------*/
void usart2_init(uint32_t baudrate);
void usart_send_data(uint8_t *buf,uint8_t len);
void usart2_send_test_data(void);

#ifdef __cplusplus
extern "C"{
#endif

#endif /* _UART_H_ */

/***************************************** (END OF FILE) *********************************************/
